<template>
  <el-dialog title="添/改" :visible.sync="showFlag.status">
  <el-form :model="form" :rules="rules">
    <el-form-item label="日期" prop="date">
      <el-input v-model="form.date" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="姓名" prop="name">
      <el-input v-model="form.name" autocomplete="off"></el-input>
    </el-form-item>

  
  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="showFlag.status = false">取 消</el-button>
    <el-button type="primary" @click="pushData">确 定</el-button>
  </div>
</el-dialog>
</template>

<script>
import vm from '../../vm/vm'
export default {
    props:["showFlag"],
 created(){
    vm.$on("sendData",(res)=>{
        this.showFlag.status = true
       this.form=res
      
    })
 },
 methods:{
     pushData(){
       
         vm.$emit("fromData",this.form)
         this.showFlag.status = false
          this.form={
                id:"",
                name: '',
                date: '',
          }
     
     }
 },
 data() {
      return {

        form: {
            id:"",
          name: '',
          date: '',
     
        },
            //校验
         rules:{
          name:{required:true,message:"不可为空",trigger:'blur'},
          date:{required:true,message:"不可为空",trigger:'blur'},
         }
      }
      
    
    }
   
}
</script>

<style>

</style>